/**
 * 
 */
package three_star_craft.uap.state;

import org.grlea.log.SimpleLogger;

import three_star_craft.uap.UapGenerator;
import three_star_craft.uap.event.EventUapConnectionCfm;
import three_star_craft.uap.event.EventUapConnectionRej;
import three_star_craft.uap.event.EventUapConnectionReleaseCfm;
import three_star_craft.uap.event.EventUapMediaBearerSetupCfm;
import three_star_craft.uap.timer.TimerEvent;

/**
 * Base class for all UAP generator states
 * 
 * @author w.antosiewic
 *
 */
public abstract class UapStateBase
{
    private static final SimpleLogger logger = new SimpleLogger(UapStateBase.class);

    /**
     * Name of the state
     */
    protected String _name;
    
    /**
     * Initializes this base class with specified state name
     * @param name of the UAP state
     */
    protected UapStateBase(String name)
    {
        _name = name;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString()
    {
        return "UapState:"+_name;
    }
    
	/**
	 * Default implementation of event handling for {@link EventUapConnectionRej}
	 * which simply prints an error.
	 * Subclasses shall provide implementation for this event when applicable.
	 * 
	 * @param generator for which the event occurred
	 * @param event an instance of event
	 */
	public void handleUapConnectionReject(
	        UapGenerator generator,
	        EventUapConnectionRej event)
	{
		logger.error(toString()+" - unhandled event: "+event.sigNo());
	}

	/**
	 * Default implementation of event handling for {@link EventUapConnectionCfm}
     * which simply prints an error.
     * Subclasses shall provide implementation for this event when applicable.
     * 
	 * @param generator for which the event occurred
     * @param event an instance of event
	 */
	public void handleUapConnectionConfirm(
	        UapGenerator generator,
	        EventUapConnectionCfm event)
	{
	    logger.error(toString()+" - unhandled event: "+event.sigNo());
	}

	/**
     * Default implementation of event handling for {@link EventUapConnectionReleaseCfm}
     * which simply prints an error.
     * Subclasses shall provide implementation for this event when applicable.
     * 
     * @param generator for which the event occurred
     * @param event an instance of event
     */
	public void handleUapConnectionReleaseConfirm(
	        UapGenerator generator,
            EventUapConnectionReleaseCfm event)
    {
	    logger.error(toString()+" - unhandled event: "+event.sigNo());
    }

	/**
     * Default implementation of event handling for timer tWaitForConectionCfm - 
     * which simply prints an error.
     * Subclasses shall provide implementation for this event when applicable.
     * 
     * @param generator for which the event occurred
     * @param event an instance of event
     */
	public void handleUapTimerWaitForConnectionCfm(
	        UapGenerator generator,
	        TimerEvent event)
	{
	    logger.error(toString()+" - unhandled event: "+event.sigNo());
	}

	/**
     * Default implementation of event handling for timer tWaitForMediaBearerCfm - 
     * which simply prints an error.
     * Subclasses shall provide implementation for this event when applicable.
     * 
     * @param generator for which the event occurred
     * @param event an instance of event
     */
    public void handleUapTimerWaitForMediaBearerCfm(
            UapGenerator generator,
            TimerEvent event)
    {
        logger.error(toString()+" - unhandled event: "+event.sigNo());
    }

    /**
     * Default implementation of event handling for {@link EventUapMediaBearerSetupCfm}
     * which simply prints an error.
     * Subclasses shall provide implementation for this event when applicable.
     * 
     * @param generator for which the event occurred
     * @param event an instance of event
     */
    public void handleUapMediaBearerSetupConfirm(
            UapGenerator generator,
            EventUapMediaBearerSetupCfm event)
    {
        logger.error(toString()+" - unhandled event: "+event.sigNo());
    }

    
}
